<link rel="stylesheet" href="<?php echo $this->webroot;?>css/bootstrap-tagsinput.css"/>
<script type="text/javascript" src="<?php echo $this->webroot;?>js/typeahead.min.js"></script>    
<script type="text/javascript" src="<?php echo $this->webroot;?>js/bootstrap-tagsinput.min.js"></script>    
<div class="row">
    <div class="col-md-8 col-md-offset-2" style="background: #fff; padding-bottom: 50px;">
        <h2 class="text-center"><?php echo __("INSERISCI LINK") ?></h2>
        <form role="form" name="Link" method="post" action="<?php echo $this->webroot?>Link/save" >
          <input type="hidden" name="Link[id]" id="link_id" value="" />
          <br>
		  <div class="row">
	          <div class="form-group  col-md-12">
   		            <label for="bookmaker_id">Bookmaker associato:</label>
	                <?php foreach ($bookmaker_list as $bookmaker) { 
	                	if ($bm["Bookmaker"]["id"]==$bookmaker["Bookmaker"]["id"]) { ?>
				          <input type="hidden" name="Link[bookmaker_id]" value="<?php echo $bookmaker["Bookmaker"]["id"] ?>" />
	                      <label ><?php echo $bookmaker["Bookmaker"]["nome"]; ?></label>
	                	<?php } ?>
	                <?php } ?>
	          </div>
          </div>
		  <div class="row">
	           <div class="form-group  col-md-12">
	            <label for="lang_id">Lingua:</label><br>
	            <select style="width: 393px;" id="bookmaker_id" name="Link[lang_id]">
	                <?php foreach ($this->Session->read("langlist") as $key => $lang) { ?>
	                    <option value="<?php echo $key; ?>"><?php echo $lang["name"]; ?></option>
	                <?php } ?>
	            </select>   
	          </div>
          </div>
		  <div class="row">
	          <div class="form-group  col-md-12">
	            <label for="link">Link:</label>
	            <input type="text" class="form-control" id="link" name="Link[link]" value="" placeholder="Inserisci il link">
	          </div>   
          </div>
		  <div class="row">
	          <div class="col-md-12 ">
	              <button type="submit" class="btn btn-primary">Salva</button>
	              <a  href="<?php echo $this->webroot?>Bookmakers/edit/<?php echo $bm["Bookmaker"]["id"]; ?>" class="btn">Annulla</a>
	          </div>
          </div>
        </form>
   </div>
  </div>
  <script>
      
  
    
    function format(data) {
        console.log(data);
        return "<img class='banner_thumb' src='<?php echo $this->webroot?>" + data.id + "'/>" + data.text;
    }
    
    $(document).ready(
        function() { 
            
            $("#bookmaker_id,#lang_id").select2({
                placeholder: "Seleziona un valore"
            }); 
            
        });
      
  </script>